Skip to content

feat!: remove built-ins polyfills on node >= 18 #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

jacob-ebey
Copy link
Member

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Aug 21, 2023

🦋 Changeset detected

Latest commit: 4f118d2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@remix-run/web-form-data Major
@remix-run/web-fetch Major
@remix-run/web-file Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 60 out of 62 changed files in this pull request and generated no comments.

Files not reviewed (2)
  • package.json: Language not supported
  • packages/blob/package.json: Language not supported
Comments suppressed due to low confidence (1)

packages/blob/test/all.spec.js:1

  • The removal of all test files eliminates regression tests for the native built-ins. It is recommended to add new tests verifying that Node >=18 correctly supports the built-in implementations to ensure ongoing reliability.
import { test as blobTest } from "./blob.spec.js"

@brophdawg11 brophdawg11 removed their request for review May 1, 2025 20:26
@MichaelDeBoey
Copy link
Member

@jacob-ebey It seems like all is fine to be merged and released.
Anything that's holding us back to do so?

@brophdawg11
Copy link

I don't think we plan to maintain this package any longer because we can use built in node fetch

@MichaelDeBoey
Copy link
Member

@brophdawg11 If so, we should maybe add a deprecation notice to the repo + npm packages and maybe also archive the repo?

@MichaelDeBoey
Copy link
Member

@brophdawg11 Just noticed @remix-run/web-fetch is still used by create-react-router though.
Since we're using the agent option (see node-fetch's docs), we can't just remove @remix-run/web-fetch as it's not supported by native Fetch API 😢

@brophdawg11
Copy link

we should maybe add a deprecation notice to the repo + npm packages and maybe also archive the repo?

yeah probably - I'll check with the team

What exactly is agent doing for us? I just updated a local create-react-router build to use native fetch and commented out the agent line and it worked without issue...

I did find this as a potential way to do agent-like stuff via dispatcher - but we should only look into that ff we can find specific scenarios where native fetch breaks without agent

@talentlessguy
Copy link

agent allows specifyng a custom HTTP agent for things like force-using a specific IP version (IPv4/IPv6) and other low-level stuff

@MichaelDeBoey
Copy link
Member

MichaelDeBoey commented Aug 7, 2025

@talentlessguy We're only using the agent option in 2 places in create-react-router:

let response = await fetch(releaseUrl, {
  agent: agent("https://api.github.com"),
  headers,
});
let resourceUrl = tarballUrl; // could be a user-provided URL

// ...

resourceUrl = `https://api.github.com/repos/${info.owner}/${info.name}/releases/assets/${assetId}`;

// ...

let response = await fetch(resourceUrl, {
    agent: agent(resourceUrl),
    headers,
  });

where

import { ProxyAgent } from "proxy-agent";

const defaultAgent = new ProxyAgent();
const httpsAgent = new ProxyAgent();
httpsAgent.protocol = "https:";
function agent(url: string) {
  return new URL(url).protocol === "https:" ? httpsAgent : defaultAgent;
}

I guess that's showing us that using the agent option isn't necessary?
Or am I missing some things here?

CC/ @markdalgleish since you did both the original create-remix & create-react-router

@MichaelDeBoey
Copy link
Member

MichaelDeBoey commented Aug 7, 2025

I created a PR to remove @remix-run/web-fetch usage and go with native Fetch, but that seems to trigger a test failure of a test that's actually using an env var proxy.
remix-run/react-router#14140 (comment)

Not sure if that's a use-case we want to support though 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants